DEFINE MISSIONS 1              // Total Missions Available
DEFINE MISSION 0 AT @MISSN_18

DEFINE EXTERNAL_SCRIPTS 0 

DEFINE UNKNOWN_EMPTY_SEGMENT 0

DEFINE UNKNOWN_THREADS_MEMORY 500

{$VERSION 3.1.0027}
var
 $PLAYER_CHAR: Player
end // var 
//Main thread starts here
03A4: name_thread 'MAIN' 
//Set the screen BLACK immediately
016A: fade 0 time 0           
01F0: set_max_wanted_level_to 6 
0111: toggle_wasted_busted_check 0 
00C0: set_current_time_hours_to 8 minutes_to 0 
//Loads Tenpenny as #SPECIAL01 or 290
023C: load_special_actor 'TENPEN' as 1 
//Create Player at Station
04E4: unknown_refresh_game_renderer_at 1541 -1675.4 
Camera.SetAtPos(1541.156, -1675.352, 13.55)
$PLAYER_CHAR = Player.Create(#NULL, 1541.156, -1675.352, 13.552)
Player.SetClothes($PLAYER_CHAR, "VEST", "VEST", Torso)
Player.SetClothes($PLAYER_CHAR, "JEANSDENIM", "JEANS", Legs)
Player.SetClothes($PLAYER_CHAR, "SNEAKERBINCBLK", "SNEAKER", Shoes)
Player.SetClothes($PLAYER_CHAR, "PLAYER_FACE", "HEAD", Head)  
Player.Build($PLAYER_CHAR)
//Changes the player to ped model 290 Tenpenny
09C7: change_player $PLAYER_CHAR model_to 290 
01F5: $PLAYER_ACTOR = create_player_actor $PLAYER_CHAR 
07AF: $PLAYER_GROUP = player $PLAYER_CHAR group 
Model.Load(#COPBIKE)
Model.Load(#COPCARLA)
Model.Load(#DESERT_EAGLE)
Model.Load(#COLT45)
038B: load_requested_models 

:MAIN_110
if or
not Model.Available(#COPBIKE)
not Model.Available(#COPCARLA)
not Model.Available(#DESERT_EAGLE)
not Model.Available(#COLT45)
else_jump @MAIN_120 
wait 0 
jump @MAIN_110 
:MAIN_120
0674: set_car_model #COPCARLA numberplate "_CRASH_"
$My_Car = Car.Create(#COPCARLA,  1535.743, -1678.094, 13.09914)
$My_Bike = Car.Create(#COPBIKE, 1535.743, -1665.094, 13.09914)
Car.SetImmunities($My_Car, 0, 1, 0, 0, 0) 
Car.Angle($My_Car) = 0                       //Headed North
Car.DoorStatus($My_Car, 0)                   //No locked doors
053F: set_car $My_Car tires_vulnerability 0  //No popped tries


01B6: set_weather 1 
0001: wait 0 ms 
01B4: toggle_player $PLAYER_CHAR can_move false //We shut down control for the cameras to work 
04BB: select_interior 0 
0629: change_integer_stat 181 to 4 
016C: restart_if_wasted_at 2027.77 -1420.52 15.99 angle 137.0 town_number 0 
016D: restart_if_busted_at 1550.68 -1675.49 14.51 angle 90.0 town_number 0 
// Note: your missions have to use the variable defined here
0180: set_on_mission_flag_to $ONMISSION  
0004: $DEFAULT_WAIT_TIME = 250
03E6: remove_text_box 
$MISSION_1 = 2
// START GAME
$ONMISSION = 0 
06C8: enable_riot true

01B4: toggle_player $PLAYER_CHAR can_move true               
fade 1 1000 
:MAIN_LOOP
0001: wait $DEFAULT_WAIT_TIME ms
00BF: $TIME_HOURS = current_time_hours, $TIME_MINS = current_time_minutes
if and
$ONMISSION == 0
00E1:   player 0 pressed_key 11   //Yes
jf @MAIN_LOOP
start_mission 0

0002: jump @MAIN_LOOP 

:MISSN_18
03A4: name_thread 'MISSN_18'
$ONMISSION = 1
0050: gosub @MISSN_18_Begin
00D6: if
0112:   wasted_or_busted
004D: jump_if_false @MISSN_18_End
0050: gosub @MISSN_18_Failed

:MISSN_18_End
0050: gosub @MISSN_18_Cleanup
004E: end_thread

:MISSN_18_Begin
fade 0 0
:MISSN_18_FADE1
wait 0
if 
not fading
jf @MISSN_18_FADE1

Model.Load(#FIRE_EX)
Model.Load(#BODYARMOUR)
Model.Load(#HEALTH)
Model.Load(#DESERT_EAGLE)
Model.Load(#COLT45)
Model.Load(#SHOTGSPA)
Model.Load(#TEARGAS)
Model.Load(#WFYRI)
Model.Load(#WFYBU)

:MISSN_18_models1
wait 0
if and
Model.Available(#FIRE_EX)
Model.Available(#BODYARMOUR)   
Model.Available(#HEALTH)        
Model.Available(#DESERT_EAGLE) 
Model.Available(#COLT45)
Model.Available(#SHOTGSPA)
Model.Available(#TEARGAS)
Model.Available(#WFYRI)
Model.Available(#WFYBU)
jf @MISSN_18_models1

Player.CanMove($PLAYER_CHAR) = false
04BB: select_interior 10 
04F9: set_interior 1 color_to 0  
0860: link_actor $PLAYER_ACTOR to_interior 10 
Actor.PutAt($PLAYER_ACTOR,274.8, 125.795, 1008.8203)
Actor.Angle($PLAYER_ACTOR) = 182.0
03DE: set_pedestrians_density_multiplier_to 1.0 
0812: AS_actor $PLAYER_ACTOR perform_animation "SEAT_IDLE" IFP_file "PED" 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time 30000 // versionB 
067E: put_camera_on_actor $PLAYER_ACTOR with_offset -1.5 1.5 1.0 point_to_actor $PLAYER_ACTOR 0.0 mode 2 

060A: create_decision_maker_type 2 store_to 40@  
060A: create_decision_maker_type 3 store_to 41@  
//Debris Blocking Exit (exit won't work anyways)
140@ = Object.Create(#VENDMACHFD,0.0, 0.0, 0.0)    //14
141@ = Object.Create(#CR_GUNCRATE,0.0, 0.0, 0.0)   //151
142@ = Object.Create(#GUNBOX,0.0, 0.0, 0.0)        //152
143@ = Object.Create(#CM_BOX,0.0, 0.0, 0.0)        //160
144@ = Object.Create(#CARDBOARDBOX2,0.0, 0.0, 0.0) //162
Object.PutAt(140@,246.77, 108.0, 1002.75)
0453: set_object 140@ XY_rotation 0.0 90.0 angle 177.5
Object.PutAt(141@,246.91, 108.27, 1003.15)
Object.PutAt(142@,247.11, 108.8, 1002.61)
Object.Angle(142@) = 56.0
Object.PutAt(143@,245.18, 108.12, 1003.61)
Object.Angle(143@) = 23.0
Object.PutAt(144@,248.0, 108.0, 1002.61)
Object.Angle(144@) = 36.0
141@ = Object.Create(#CR_GUNCRATE,0.0, 0.0, 0.0)   //151
142@ = Object.Create(#GUNBOX,0.0, 0.0, 0.0)        //152
143@ = Object.Create(#CM_BOX,0.0, 0.0, 0.0)        //160
144@ = Object.Create(#CARDBOARDBOX2,0.0, 0.0, 0.0) //162
Object.PutAt(141@,246.23, 108.4, 1003.51)
Object.Angle(141@) = 44.0
Object.PutAt(142@,247.94, 108.0, 1003.25)
Object.Angle(142@) = 10.5
Object.PutAt(143@,245.67, 107.61, 1003.61)
Object.Angle(143@) = -124.5
Object.PutAt(144@,244.34, 108.94, 1002.61)
Object.Angle(144@) = 21.0
//Other exit
132@ = Object.Create(#GEN_DOOREXT03,0.0, 0.0, 0.0)
Object.PutAt(132@,273.37, 122.88, 1003.61)
Object.Angle(132@) = -90.0
032B: 133@ = create_weapon_pickup #DESERT_EAGLE group 3 ammo 30 at 262.4986 108.577 1004.6172
032B: 133@ = create_weapon_pickup #SHOTGSPA group 3 ammo 10 at 265.4215 108.577 1004.6172
032B: 133@ = create_weapon_pickup #TEARGAS group 3 ammo 3 at 262.4986 110.862 1004.6172
032B: 134@ = create_weapon_pickup #FIRE_EX group 3 ammo 30000 at 225.1263 120.8967 999.0795
135@ = Pickup.Create(#BODYARMOUR, 3, 259.0639, 117.4559, 1003.2187)
136@ = Pickup.Create(#HEALTH, 3, 216.2749, 110.5454, 1003.2187)
032B: 137@ = create_weapon_pickup #DESERT_EAGLE group 3 ammo 30 at 276.4326 114.3568 1008.813
02A3: enable_widescreen true 

fade 1 1500
:MISSN_18_FADE2
wait 0
if 
not fading
jf @MISSN_18_FADE2
//Lawyers
Actor.Create(138@,24,#WFYBU,270.9785, 119.8345, 1008.8203)
Actor.Create(139@,24,#WFYRI,271.6311, 118.7255, 1008.813)
03CF: load_wav 44430 as 1                            
gosub @MISSN_18_PLAYSND                              
067E: put_camera_on_actor $PLAYER_ACTOR with_offset -4.5 5.0 1.0 point_to_actor $PLAYER_ACTOR 0.0 mode 2 
03CF: load_wav 44431 as 1 
gosub @MISSN_18_PLAYSND 
0603: AS_actor 138@ goto 274.702 123.6552 1008.8203 mode 4 timelimit -1  
0603: AS_actor 139@ goto 276.982 124.4508 1008.8203 mode 4 timelimit -1  
03CF: load_wav 44432 as 1 
gosub @MISSN_18_PLAYSND 
0A1D: AS_actor 138@ rotate_to_and_look_at_actor $PLAYER_ACTOR 
0A1D: AS_actor 139@ rotate_to_and_look_at_actor $PLAYER_ACTOR 
067E: put_camera_on_actor $PLAYER_ACTOR with_offset 0.0 0.0 1.5 point_to_actor 139@ 0.0 mode 2 
03CF: load_wav 44433 as 1 
gosub @MISSN_18_PLAYSND 
067E: put_camera_on_actor $PLAYER_ACTOR with_offset -3.0 0.0 1.0 point_to_actor $PLAYER_ACTOR 0.0 mode 2 
0603: AS_actor 138@ goto 264.45 122.0963 1005.2278 mode 4 timelimit -1 
wait 250 
0603: AS_actor 139@ goto 264.45 122.0963 1005.2278 mode 4 timelimit -1
wait 7000
Player.CanMove($PLAYER_CHAR) = true
Camera.SetBehindPlayer
Camera.Restore_WithJumpCut
02A3: enable_widescreen false
Actor.DestroyWithFade(138@)
Actor.DestroyWithFade(139@)
//No Crime
01F0: set_max_wanted_level_to 0 
//Everyone hates you and cops
0746: set_acquaintance 4 of_actors_pedtype 1 to_actors_pedtype 0 
0746: set_acquaintance 4 of_actors_pedtype 2 to_actors_pedtype 0 
0746: set_acquaintance 4 of_actors_pedtype 3 to_actors_pedtype 0 
0746: set_acquaintance 4 of_actors_pedtype 4 to_actors_pedtype 0 
0746: set_acquaintance 4 of_actors_pedtype 5 to_actors_pedtype 0 
0746: set_acquaintance 1 of_actors_pedtype 6 to_actors_pedtype 0 
0746: set_acquaintance 4 of_actors_pedtype 7 to_actors_pedtype 0 
0746: set_acquaintance 4 of_actors_pedtype 8 to_actors_pedtype 0 
0746: set_acquaintance 4 of_actors_pedtype 9 to_actors_pedtype 0 
0746: set_acquaintance 4 of_actors_pedtype 10 to_actors_pedtype 0
0746: set_acquaintance 4 of_actors_pedtype 11 to_actors_pedtype 0
0746: set_acquaintance 4 of_actors_pedtype 12 to_actors_pedtype 0
0746: set_acquaintance 4 of_actors_pedtype 13 to_actors_pedtype 0
0746: set_acquaintance 4 of_actors_pedtype 14 to_actors_pedtype 0
0746: set_acquaintance 4 of_actors_pedtype 17 to_actors_pedtype 0
0746: set_acquaintance 4 of_actors_pedtype 18 to_actors_pedtype 0
0746: set_acquaintance 4 of_actors_pedtype 19 to_actors_pedtype 0
0746: set_acquaintance 4 of_actors_pedtype 20 to_actors_pedtype 0
0746: set_acquaintance 4 of_actors_pedtype 1 to_actors_pedtype 6 
0746: set_acquaintance 4 of_actors_pedtype 2 to_actors_pedtype 6 
0746: set_acquaintance 4 of_actors_pedtype 3 to_actors_pedtype 6 
0746: set_acquaintance 4 of_actors_pedtype 4 to_actors_pedtype 6 
0746: set_acquaintance 4 of_actors_pedtype 5 to_actors_pedtype 6 
0746: set_acquaintance 1 of_actors_pedtype 6 to_actors_pedtype 6 
0746: set_acquaintance 4 of_actors_pedtype 7 to_actors_pedtype 6 
0746: set_acquaintance 4 of_actors_pedtype 8 to_actors_pedtype 6 
0746: set_acquaintance 4 of_actors_pedtype 9 to_actors_pedtype 6 
0746: set_acquaintance 4 of_actors_pedtype 10 to_actors_pedtype 6
0746: set_acquaintance 4 of_actors_pedtype 11 to_actors_pedtype 6
0746: set_acquaintance 4 of_actors_pedtype 12 to_actors_pedtype 6
0746: set_acquaintance 4 of_actors_pedtype 13 to_actors_pedtype 6
0746: set_acquaintance 4 of_actors_pedtype 14 to_actors_pedtype 6
0746: set_acquaintance 4 of_actors_pedtype 17 to_actors_pedtype 6
0746: set_acquaintance 4 of_actors_pedtype 18 to_actors_pedtype 6
0746: set_acquaintance 4 of_actors_pedtype 19 to_actors_pedtype 6
0746: set_acquaintance 4 of_actors_pedtype 20 to_actors_pedtype 6
//Start Riot in Building 
020C: create_explosion_with_radius 3 at 215.8663 125.1664 1003.2187 
0003: shake_camera 40 
wait 3000
020C: create_explosion_with_radius 3 at 230.5392 117.463 1003.2187 
0003: shake_camera 40 
//Building on Fire
02CF: 70@ = create_fire_at 264.45 122.0963 1005.2278 propagation 0 size 3 
02CF: 71@ = create_fire_at 233.0853 126.6303 1011.2198 propagation 0 size 2 
02CF: 72@ = create_fire_at 232.3509 124.0306 1010.2187 propagation 0 size 3 
02CF: 73@ = create_fire_at 227.4438 113.7354 1010.2187 propagation 0 size 2 
02CF: 74@ = create_fire_at 232.3411 117.7504 1003.2187 propagation 0 size 3 
02CF: 75@ = create_fire_at 239.5644 117.5274 1003.2187 propagation 0 size 2 
02CF: 76@ = create_fire_at 246.777 109.6354 1003.2257 propagation 0 size 3 
02CF: 77@ = create_fire_at 244.1821 107.9638 1003.2187 propagation 0 size 2 
02CF: 78@ = create_fire_at 259.6979 114.1201 1004.5063 propagation 0 size 3 
02CF: 79@ = create_fire_at 249.2738 108.0166 1003.2187 propagation 0 size 3 
02CF: 80@ = create_fire_at 253.1785 125.3949 1003.2187 propagation 0 size 2 
//Ten random actors that want to kill you
0376: 101@ = create_random_actor_at 262.7928 121.9764 1004.6172 
0376: 102@ = create_random_actor_at 244.4454 124.5251 1003.2187
0376: 103@ = create_random_actor_at 246.3382 114.1465 1003.2187
0376: 104@ = create_random_actor_at 268.8792 114.1012 1004.6172
0376: 105@ = create_random_actor_at 277.377 124.8368 1004.6172
0376: 106@ = create_random_actor_at 217.8197 120.1698 999.0156
0376: 107@ = create_random_actor_at 224.5928 117.3595 1010.2187
0376: 108@ = create_random_actor_at 235.6292 122.3062 1010.2187
0376: 109@ = create_random_actor_at 251.563 120.7605 1010.2187
0376: 110@ = create_random_actor_at 230.8479 126.478 1010.2187
//Weapons given to the last eight
01B2: give_actor 103@ weapon 22 ammo 100 
01B2: give_actor 104@ weapon 22 ammo 100 
01B2: give_actor 105@ weapon 22 ammo 100 
01B2: give_actor 106@ weapon 22 ammo 100 
01B2: give_actor 107@ weapon 22 ammo 100 
01B2: give_actor 108@ weapon 24 ammo 50 
01B2: give_actor 109@ weapon 27 ammo 10 
01B2: give_actor 110@ weapon 27 ammo 10 
//Actors attack on sight
060B: set_actor 101@ decision_maker_to 40@ 
060B: set_actor 102@ decision_maker_to 40@ 
060B: set_actor 103@ decision_maker_to 40@ 
060B: set_actor 104@ decision_maker_to 40@ 
060B: set_actor 105@ decision_maker_to 40@ 
060B: set_actor 106@ decision_maker_to 40@ 
060B: set_actor 107@ decision_maker_to 40@ 
060B: set_actor 108@ decision_maker_to 40@ 
060B: set_actor 109@ decision_maker_to 40@ 
060B: set_actor 110@ decision_maker_to 40@
04EB: AS_actor 109@ crouch true 
04EB: AS_actor 110@ crouch true 
//Ten Scared Cops
Actor.Create(111@,6,#LAPD1,264.3351, 108.6235, 1009.0312)
Actor.Create(112@,6,#LAPD1,260.47, 109.7338, 1009.0312)
Actor.Create(113@,6,#LAPD1,243.3733, 122.4623, 1010.2187)
Actor.Create(114@,6,#LAPD1,235.5254, 108.1263, 1010.2118)
Actor.Create(115@,6,#LAPD1,222.6093, 122.1136, 1010.2118)
Actor.Create(116@,6,#LAPD1,220.1763, 110.8085, 1003.2187)
Actor.Create(117@,6,#LAPD1,251.9155, 117.6549, 1003.2187)
Actor.Create(118@,6,#LAPD1,258.2711, 110.4658, 1003.2187)
Actor.Create(119@,6,#LAPD1,266.1222, 119.8283, 1004.6172)
Actor.Create(120@,6,#LAPD1,276.6938, 110.5832, 1004.6172)
05DE: AS_actor 111@ walk_around_ped_path 
05DE: AS_actor 112@ walk_around_ped_path 
05DE: AS_actor 113@ walk_around_ped_path 
05DE: AS_actor 114@ walk_around_ped_path 
05DE: AS_actor 115@ walk_around_ped_path 
05DE: AS_actor 116@ walk_around_ped_path 
05DE: AS_actor 117@ walk_around_ped_path 
05DE: AS_actor 118@ walk_around_ped_path 
05DE: AS_actor 119@ walk_around_ped_path 
05DE: AS_actor 120@ walk_around_ped_path 

060B: set_actor 111@ decision_maker_to 41@ 
060B: set_actor 112@ decision_maker_to 40@ 
060B: set_actor 113@ decision_maker_to 41@ 
060B: set_actor 114@ decision_maker_to 40@ 
060B: set_actor 115@ decision_maker_to 41@ 
060B: set_actor 116@ decision_maker_to 40@ 
060B: set_actor 117@ decision_maker_to 41@ 
060B: set_actor 118@ decision_maker_to 40@ 
060B: set_actor 119@ decision_maker_to 41@ 
060B: set_actor 120@ decision_maker_to 40@ 
//Give the men standard issue
01B2: give_actor 111@ weapon 22 ammo 100 
01B2: give_actor 112@ weapon 22 ammo 100 
01B2: give_actor 113@ weapon 22 ammo 100 
01B2: give_actor 114@ weapon 22 ammo 100 
01B2: give_actor 115@ weapon 22 ammo 100 
01B2: give_actor 116@ weapon 22 ammo 100 
01B2: give_actor 117@ weapon 22 ammo 100 
01B2: give_actor 118@ weapon 22 ammo 100 
01B2: give_actor 119@ weapon 22 ammo 100 
01B2: give_actor 120@ weapon 22 ammo 100 

100@ = 0      
:MISSN_18_LOOP1
wait 0


if 
00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 274.4978 122.0967 1004.6172 radius 1.0 1.0 1.0 
jf @MISSN_18_LOOP1
//Take away fire extingisher
0555: remove_weapon 42 from_actor $PLAYER_ACTOR 
04BB: select_interior 0  
0860: link_actor $PLAYER_ACTOR to_interior 0 
Actor.PutAt($PLAYER_ACTOR,1480.4899, -1769.3979, 18.7958)
Actor.Angle($PLAYER_ACTOR) = 350.0
Camera.SetBehindPlayer
0394: play_music 1 
01E3: show_text_1number_styled GXT 'M_PASSR' number 7 time 5000 style 1  // MISSION PASSED!~n~~w~RESPECT +
0998: add_respect 1
wait 5000
0051: return

:MISSN_18_PLAYSND
wait 0
if 
03D0:   wav 1 loaded 
jf @MISSN_18_PLAYSND
03D1: play_wav 1 
:MISSN_18_PLAYING
wait 0
if 
03D2:   wav 1 ended 
jf @MISSN_18_PLAYING
040D: unload_wav 1 
return

:MISSN_18_Failed

0051: return

:MISSN_18_Cleanup
Actor.DestroyInstantly(101@)
Actor.DestroyInstantly(102@)
Actor.DestroyInstantly(103@)
Actor.DestroyInstantly(104@)
Actor.DestroyInstantly(105@)
Actor.DestroyInstantly(106@)
Actor.DestroyInstantly(107@)
Actor.DestroyInstantly(108@)
Actor.DestroyInstantly(109@)
Actor.DestroyInstantly(110@)
Actor.DestroyInstantly(111@)
Actor.DestroyInstantly(112@)
Actor.DestroyInstantly(113@)
Actor.DestroyInstantly(114@)
Actor.DestroyInstantly(115@)
Actor.DestroyInstantly(116@)
Actor.DestroyInstantly(117@)
Actor.DestroyInstantly(118@)
Actor.DestroyInstantly(119@)
Actor.DestroyInstantly(120@)
Model.Destroy(#FIRE_EX)
Model.Destroy(#BODYARMOUR)
Model.Destroy(#HEALTH)
Model.Destroy(#DESERT_EAGLE)
Model.Destroy(#COLT45)
Model.Destroy(#SHOTGSPA)
Model.Destroy(#TEARGAS)
Model.Destroy(#WFYRI)
Model.Destroy(#WFYBU)
$ONMISSION = 0 
00D8: mission_cleanup 
0051: return 

